import os
import pandas as pd
db_name="ts"
col_name="2.his数据下载_fast1"
path_mongo_db = os.path.dirname(os.path.dirname(__file__))
path_ = os.path.join(path_mongo_db, "mongo_db", "{}".format(db_name), '{}.json'.format(col_name))
df=pd.read_csv(path_, encoding="utf-8",index_col=0)
print(df)
df = df.dropna(axis=0, how='any')
print(df.info())
df['code'] = df['code'].astype(int).astype(str).str.zfill(6)  # 1补缺
df = df.loc[:, ~df.columns.str.contains('^Unnamed')].drop_duplicates()  # 2去掉Unnamed 并且去重
df = df[~df['code'].str.startswith('4')]
df = df[~df['code'].str.startswith('8')]
df = df[~df['code'].str.startswith('9')]
print(df.info())
print("读取地址",path_)
